package com.wisevar.thirdplatform.gateway.model.common;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class PageResult<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private List<T> content = new ArrayList<>();

    private long total;

    public PageResult() {

    }

    public PageResult(List<T> content, long total) {
        setContent(content);
        this.total = total;
    }

    public void setContent(List<T> content) {
        if (content == null) {
            content = new ArrayList<>();
        }
        this.content = content;
    }

    public static <T> PageResult<T> build(List<T> content, long total) {
        return new PageResult<>(content, total);
    }

}
